{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7de1a497",
   "metadata": {},
   "source": [
    "* 第四周 \n",
    "* 记录人：陈铮铮\n",
    "* 2022/9/13"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6079307b",
   "metadata": {},
   "source": [
    "# 本周内容\n",
    "\n",
    "* type():检查类型\n",
    "\n",
    "> 1. 数值\n",
    ">> 1. int\n",
    ">> 2. float\n",
    ">> 3. complex\n",
    "\n",
    "\n",
    "> 2. 字符串"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "46053be5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9 <class 'int'>\n"
     ]
    }
   ],
   "source": [
    "## Number(数值)\n",
    "\n",
    "a=9\n",
    "print(a,type(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "18354390",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "11.5 <class 'float'>\n"
     ]
    }
   ],
   "source": [
    "b=11.5\n",
    "print(b,type(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "23fcd230",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(5+3j) <class 'complex'>\n"
     ]
    }
   ],
   "source": [
    "## complex(虚数，复数)\n",
    "c =5+3j\n",
    "print(c,type(c))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eed665f8",
   "metadata": {},
   "source": [
    "# 字符串（string）\n",
    "\n",
    "> 1. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6f8af783",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Alex <class 'str'>\n"
     ]
    }
   ],
   "source": [
    "name =\"Alex\"\n",
    "print(name,type(name))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "6869a1e8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"doesn't\""
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"doesn't\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d3fc2ecc",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'nfu_index_pages_html' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [6]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mnfu_index_pages_html\u001b[49m)\n",
      "\u001b[1;31mNameError\u001b[0m: name 'nfu_index_pages_html' is not defined"
     ]
    }
   ],
   "source": [
    "print(nfu_index_pages_html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7883010d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "广州南方学院坐落于广州市从化温泉镇\n"
     ]
    }
   ],
   "source": [
    "# 关于有序性\n",
    "title = \"广州南方学院坐落于广州市从化温泉镇\"\n",
    "print(title)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "5e5fad1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'学'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title[4] #取单一值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1d529929",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(title) #检查文本总长度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "bbd5fb7a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'广州南方学院'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title[0:6] # 取一定范围值，这种方法为“切片”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e8be25cc",
   "metadata": {},
   "outputs": [],
   "source": [
    "## enumerate 枚举，既可以获取内容 item，也可以获取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "1344dffe",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "广\n",
      "州\n",
      "南\n",
      "方\n",
      "学\n",
      "院\n",
      "坐\n",
      "落\n",
      "于\n",
      "广\n",
      "州\n",
      "市\n",
      "从\n",
      "化\n",
      "温\n",
      "泉\n",
      "镇\n"
     ]
    }
   ],
   "source": [
    "## 利用for循环 遍历文本信息\n",
    "for i in title:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "08e8a23f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "广州这个词在这段文本中\n",
      "广州这个词在这段文本中\n"
     ]
    }
   ],
   "source": [
    "# 如何判断一段文本中是否存在“广州”\n",
    "for i,j in enumerate(title):\n",
    "    if j ==\"广\":\n",
    "        if title[i+1] == \"州\":\n",
    "            print(\"广州这个词在这段文本中\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "4dd714f5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## page59  in 检查成员对象\n",
    "\"广州\" in title"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "53e2c5d0",
   "metadata": {},
   "source": [
    "* 字符串的拼接"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "77d5dc63",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "你好,baby\n"
     ]
    }
   ],
   "source": [
    "print(\"你好\"+\",\"+\"baby\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c461206e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
